/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.asportoonline.business.beans;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.asportoonline.entities.Cliente;
import org.asportoonline.integration.ClienteFacade;

/**
 *
 * @author fe
 */
@Stateless
public class ClienteManagerImplementation implements ClienteManager {
    @EJB
    private ClienteFacade clienteFacade;

    @Override
    public void inserisciCliente(Cliente c) {
        clienteFacade.create(c);
    }

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")

    @Override
    public List<Cliente> elencoClienti() {
        return clienteFacade.findAll();
    }

    @Override
    public Cliente cercaCliente(long id) {
        return clienteFacade.find(id);
    }

    @Override
    public Cliente cercaCliente(String email) {
        return clienteFacade.find(email);
    }

    @Override
    public void aggiornaCliente(Cliente cliente) {
        if(!(cliente == null)) {
            clienteFacade.edit(cliente);
        }
    }

    
     
}
